package main

import "strconv"

func compress(chars []byte) int {
	ret := ""
	for i := 0; i < len(chars); {
		j := i + 1
		for ; j < len(chars); j++ {
			if chars[i] != chars[j] {
				break
			}
		}
		count := j - i

		if count > 1 {
			ret += string(chars[i])
			ret += strconv.Itoa(count)
		}

		i = j
	}

	for i := 0; i < len(ret); i++ {
		chars[i] = ret[i]
	}
	return len(ret)
}
